package com.appbee.core.server.model;

import java.util.Date;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import com.appbee.core.shared.model.HasCreateDateTime;
import com.appbee.core.shared.model.HasCreateUser;
import com.appbee.core.shared.model.HasEditDateTime;
import com.appbee.core.shared.model.HasEditUser;
import com.appbee.core.shared.model.HasLongId;
import com.google.code.twig.annotation.Index;
import com.google.code.twig.annotation.Store;


@MappedSuperclass
public abstract class EditEntity implements HasEditDateTime, HasCreateDateTime,
		HasEditUser, HasCreateUser, HasLongId, HasLiveState
{
	@com.google.code.twig.annotation.Id
	private Long id;
	@Index
	@Temporal(TemporalType.TIMESTAMP)
	private Date createDateTime;
	@Temporal(TemporalType.TIMESTAMP)
	private Date editDateTime;
	private String editUserEmail;
	private String createUserEmail;
	
	@Transient
	@Store(false)
	private boolean live = true;
	
	@Override
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId()
	{
		return id;
	}

	
	@Override
	public void setId(Long id)
	{
		this.id = id;
	}
	@Override
	public Date getCreateDateTime()
	{
		return createDateTime;
	}
	
	@Override
	public void setCreateDateTime(Date createDateTime)
	{
		this.createDateTime = createDateTime;
	}

	@Override
	public Date getEditDateTime()
	{
		return editDateTime;
	}
	@Override
	public void setEditDateTime(Date editDateTime)
	{
		this.editDateTime = editDateTime;
	}

	@Override
	public boolean isLive()
	{
		return live;
	}


	@Override
	public void setLive(boolean live)
	{
		this.live = live;
	}

	@Override
	public String getEditUserEmail()
	{
		return editUserEmail;
	}

	@Override
	public void setEditUserEmail(String editUserEmail)
	{
		this.editUserEmail = editUserEmail;
	}

	@Override
	public String getCreateUserEmail()
	{
		return createUserEmail;
	}

	@Override
	public void setCreateUserEmail(String createUserEmail)
	{
		this.createUserEmail = createUserEmail;
	}
	
	
}
